-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add memberClusters selection #87
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 . Nice job!
I have only few minor comments for the tests, but they can be addressed later.
// should be skipped if there is at least one selected member cluster | ||
// and | ||
// the name is either empty or is not specified in the selected member clusters | ||
return len(s.MemberClusters) > 0 && (memberName == "" || !slices.Contains(s.MemberClusters, memberName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that there can be no "apply this entity to any member cluster"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. It's already the default behavior for the cases when you don't specify any permissions in any member cluster.
@@ -47,7 +46,7 @@ func ensureUsers(ctx *clusterContext, objsCache objectsCache) error { | |||
ctx.Printlnf("-> Ensuring Users and its RoleBindings...") | |||
|
|||
for _, user := range ctx.kubeSawAdmins.Users { | |||
if ctx.specificKMemberName != "" && slices.Contains(user.Selector.SkipMembers, ctx.specificKMemberName) { | |||
if user.Selector.ShouldBeSkippedForMember(ctx.specificKMemberName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep the empty name check here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same, the check is part of the method
@@ -16,7 +15,7 @@ type clusterContext struct { | |||
func ensureServiceAccounts(ctx *clusterContext, objsCache objectsCache) error { | |||
ctx.Printlnf("-> Ensuring ServiceAccounts and its RoleBindings...") | |||
for _, sa := range ctx.kubeSawAdmins.ServiceAccounts { | |||
if ctx.specificKMemberName != "" && slices.Contains(sa.Selector.SkipMembers, ctx.specificKMemberName) { | |||
if sa.Selector.ShouldBeSkippedForMember(ctx.specificKMemberName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we keep the empty name check ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's already part of ShouldBeSkippedForMember
method logic
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #87 +/- ##
==========================================
- Coverage 69.59% 68.00% -1.60%
==========================================
Files 43 44 +1
Lines 2565 3175 +610
==========================================
+ Hits 1785 2159 +374
- Misses 589 825 +236
Partials 191 191
|
so we can specify that particular users should be provisioned to a specific member cluster only (eg intel in DevSandbox)